" for quick save
nnoremap fs :w<Enter>

" for checking file status
nnoremap ff :f<Enter>
nnoremap F :pwd<Enter>

" for label operation
nnoremap ti :tabe<Enter>
nnoremap tt gt
nnoremap tr gT

" browsing code easily
nnoremap 8 3<C-E>
nnoremap 9 3<C-Y>
nnoremap 44 $

" browsing tags easily
nnoremap <F1> g<C-]>
nnoremap <F3> <C-o>
nnoremap <F4> <C-i>

" highlight words under cursor
nnoremap <F2> gd
nnoremap <esc> :noh<cr>

" setup code indentation quickly
vmap <tab> >gv
vmap <s-tab> <gv

" quick exit
nmap `` ZZ

" auto completion
imap )_ ) {<enter>}<esc>O
imap ){ )<enter>{<enter>}<esc>O
imap {} {<enter>}<esc>O
imap {{ {<enter>};<esc>O

" for Taglist
map <silent> <C-T> :TlistToggle<cr>

" quick add ;
imap ;; <esc>$a;<esc>

" quick add :
imap '' <esc>$a:<esc>

inoremap <s-insert> <esc>"+p`]a

nnoremap C C<Esc>

" ignore the last word in visual mode
set selection=exclusive

set cursorline

" display line number
set nu

" colorscheme
set t_Co=256
colorscheme wombat256mod

" disable Ex mode
map q: <Nop>
nnoremap Q <Nop>

" disable Syntasic check
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_check_on_open = 0

" for NERD tree
map <C-N> <leader>nn

" expand tab to 4 blanks
set ts=4
set sts=4
set expandtab

" force file format to unix
set ff=unix

" Maximum window
autocmd GUIEnter * simalt ~x

set shortmess=atI

" for windows file
set enc=utf-8

set autochdir

set tags=tags;/,.tags;/

nmap ; :

map <silent> <F8> o#ifdef __GNUC__<enter>#include "/home/isv-hz/workspace/debug.h"<esc>o#else<esc>o#include "Y:/workspace/debug.h"<esc>o#endif<enter><esc>
map <silent> <F9> oif (ret < 0) {<enter>PR_ERR("Failed to , ret[%d]", ret);<enter>goto out;<esc>kwwi

" using @o to auto add '' to element in python dicts
let @o="0i'wv/:xhPnllv$xa'pA,j"

" quick locate error
" nnoremap <F9>  :ALENext<enter>
" nnoremap <F10> :ALEDetail<enter>
" nnoremap <F11> :ALEToggle<enter>

" for quick browse tabs
:nn <M-1> 1gt
:nn <M-2> 2gt
:nn <M-3> 3gt
:nn <M-4> 4gt
:nn <M-5> 5gt
:nn <M-6> 6gt
:nn <M-7> 7gt
:nn <M-8> 8gt
:nn <M-9> 9gt
:nn <M-0> :tablast<CR>

